package p16.p1612;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * 循环的几种写法
 */
public class ArrayListDemo {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<String>();
        list.add("1");
        list.add("2");
        list.add("3");
        Iterator<String> stringIterator = list.iterator();

        while (stringIterator.hasNext()) {
            String a = stringIterator.next();
            System.out.println("a = " + a);
        }

        for (String aa : list
                ) {
            System.out.println("aa = " + aa);

        }

        for (Iterator<String> ii = list.iterator(); ii.hasNext();
                ) {
            System.out.println("ii = " + ii.next());

        }
        for (int i = 0; i < list.size(); i++) {
            String ss = list.get(i);

        }
    }
}
